package com.ssy.lingxi.logistics.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.logistics.model.request.OrderProductListRequest;
import com.ssy.lingxi.logistics.service.IFreightTemplateService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @menu App - 运费模板
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/14
 */
@RestController
@RequestMapping("/logistics/mobile/freightTemplate")
public class MobileFreightTemplateController extends BaseController {

    @Resource
    private IFreightTemplateService freightTemplateService;

    /**
     * 运费计算
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping(value = "/calFreightPrice")
    public Wrapper<BigDecimal> calFreightPrice(@RequestBody @Validated OrderProductListRequest request) {
        return freightTemplateService.calFreightPrice(request);
    }

}
